perm filename SAICVC.FAI[S,AIL] blob
sn#191948 filedate 1975-12-15 generic text, type T, neo UTF8
SEARCH HDRFIL
COMPIL(CVC,<CVSIX,CVASC,CVSTR,CVXSTR,CV6STR,CVASTR>,<SAVE,RESTR,X11,X22,INSET,STRNGC,FLSCAN>
,<CVSIX, CVASC, CVSTR, CVXSTR, CV6STR -- CHARACTER CONVERSION ROUTINES>)
HERE (CVSIX)
MOVEI A,0 ;WILL DPB THE SIXBIT INTO HERE
HRRZ TEMP,-1(SP) ;BYTE COUNT
JUMPE TEMP,CVSXX ;NULL
CAILE TEMP,6 ;ONLY USE FIRST SIX CHARS
MOVEI TEMP,6 ;
MOVE LPSA,[POINT 6,A];
PUSH P,B ;NEEDED 1 MORE AC
MOVE B,(SP) ;BYTE POINTER
CVSXXL: ILDB USER,B ;THE CHARACTER
TRZN USER,100 ;MOVE 100 BIT TO 40
TRZA USER,40 ;
TRO USER,40 ;
IDPB USER,LPSA ;PUT AWAY
SOJG TEMP,CVSXXL ;LOOP
POP P,B ;GET BACK THE EXTRA AC
CVSXX: SUB SP,X22 ;EXIT
POPJ P,
HERE (CVASC)
PUSHJ P,SAVE
POP SP,X
POP SP,B
HRRZS B ;STRING ARG
MOVEI C,5
MOVE D,[POINT 7,A]
MOVEI A,0
LUP: SOJL B,DUNN
ILDB Y,X
IDPB Y,D
SOJG C,LUP ;COLLECT CHARS IN A
DUNN: MOVEM A,RACS+1(USER) ;RESULT
MOVE LPSA,X11
JRST RESTR
HERE (CVSTR)
PUSHJ P,SAVE
MOVEI A,5
ADDM A,REMCHR(USER)
SKIPLE REMCHR(USER)
PUSHJ P,STRNGC
PUSHJ P,INSET ;ALIGN TO FW BDRY
PUSH SP,[XWD 40,5] ;BEST NON-CONSTANT STRING REP
PUSH SP,TOPBYTE(USER)
MOVEW @TOPBYTE(USER),-1(P)
AOS TOPBYTE(USER)
MOVE LPSA,X22
JRST RESTR
HERE (CVXSTR)
PUSHJ P,SAVE
MOVEI C,0 ;A FLAG
CVXST1: SKIPE SGLIGN(USER)
PUSHJ P,INSET
MOVEI A,6
ADDM A,REMCHR(USER) ;UPDATE REMAINING CHAR COUNT
SKIPLE REMCHR(USER) ;IS THERE ROOM FOR THIS STRING?
PUSHJ P,STRNGC ;NO, TRY TO GET IT
PUSH SP,[XWD 40,6] ;NON-CONST,,COUNT FOR RESULT
PUSH SP,TOPBYTE(USER) ;RESULT STARTS HERE
MOVEI A,6
MOVE B,[POINT 6,-1(P)] ;POINT AT INPUT SIXBIT
CVXLP: ILDB TEMP,B ;GET A SIXBIT CHAR
JUMPE C,CVXST2
JUMPE TEMP,CVXST3
CVXST2: ADDI TEMP,40 ;CONVERT TO ASCII
IDPB TEMP,TOPBYTE(USER) ;PUT IN RESULT STRING, UPDATE TOPBYTE
SOJG A,CVXLP ;DO IT ALL
CVXST3: MOVN A,A ;MAKE REMCHR HONEST
ADDM A,-1(SP) ;AS WELL AS BYTE CNT IN STRING
ADDM A,REMCHR(USER)
MOVE LPSA,X22 ;REMOVE ARG, RETURN ADDRESS
JRST RESTR ;AND RETURN
HEREFK(CV6STR,CV6ST.)
PUSHJ P,SAVE
MOVEI C,1
JRST CVXST1
HEREFK(CVASTR,CVAST.)
PUSHJ P,SAVE
MOVEI A,5 ;BE SURE HAVE ENOUGH ROOM
ADDM A,REMCHR(USER)
SKIPLE REMCHR(USER)
PUSHJ P,STRNGC
PUSH SP,[XWD 40,5] ;STERILE STRING CNT WD
PUSH SP,TOPBYTE(USER) ;WHAT THE DESCR WILL BE
MOVE 4,-1(P); ;
MOVEI 5,0 ;
MOVNI A,5 ;
MOVE TEMP,[POINT 7,4] ;
CVALP: ILDB C,TEMP ;PICK UP A CHARACTER
JUMPE C,CVALDN ;DONE WHEN SEE NULL
IDPB C,TOPBYTE(USER) ;PUT IT DOWN
AOJA A,CVALP
CVALDN: ;CORRECT REMCHR
ADDM A,REMCHR(USER)
ADDM A,-1(SP) ;AND STRING DESCR
MOVE LPSA,X22 ;RETURN
JRST RESTR
ENDCOM(CVC)
END